package com.swufe.team;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;

import androidx.appcompat.app.AppCompatActivity;

public class config extends AppCompatActivity {
    private static final String TAG = "Rate";
    private EditText dollarText;
    private EditText euroText;
    private EditText wonText;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_config);

        Intent intent = getIntent();
        float dollar2 = intent.getFloatExtra("dollar_key", 0.0f);
        float euro2 = intent.getFloatExtra("euro_key", 0.0f);
        float won2 = intent.getFloatExtra("won_key", 0.0f);
        Log.i(TAG, "onCreate:dollar2=" + dollar2);
        Log.i(TAG, "onCreate:euro2=" + euro2);
        Log.i(TAG, "onCreate:won2=" + won2);


        dollarText=findViewById(R.id.dollar);
        euroText=findViewById(R.id.euro);
        wonText=findViewById(R.id.won);

        dollarText.setText(String.valueOf(dollar2));
        euroText.setText(String.valueOf(euro2));
        wonText.setText(String.valueOf(won2));

    }
    public void save(View view) {

        String dollarStr=dollarText.getText().toString();
        String eurpStr=euroText.getText().toString();
        String wonStr=wonText.getText().toString();

        Intent intent =getIntent();

        Bundle bundle=new Bundle();
        bundle.putFloat("key_dollar",Float.parseFloat(dollarStr));
        bundle.putFloat("key_euro",Float.parseFloat(eurpStr));
        bundle.putFloat("key_won",Float.parseFloat(wonStr));
        intent.putExtras(bundle);

        setResult(6,intent);

        finish();


            }



}